package com.ysd.lis.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ysd.common.Result;
import com.ysd.lis.entity.ProvinceEntity;
import com.ysd.lis.mapper.ProvinceMapper;
import com.ysd.lis.service.DictProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * cold_chain.t_organization 服务实现类
 * </p>
 *
 * @author Peng
 * @since 2021-10-08
 */
@Service
@DS("two")
public class DictProvinceServiceImpl extends ServiceImpl<ProvinceMapper, ProvinceEntity> implements DictProvinceService {
    @Autowired
    ProvinceMapper provinceMapper;

    @Override
    public Result findDictProvinceList() {
        List<ProvinceEntity> provinceEntities = provinceMapper.selectList(new LambdaQueryWrapper<ProvinceEntity>());
        Map<String,Object> map = new HashMap<>();
        map.put("dataList",provinceEntities);
        return  Result.succ(1,"获取数据成功",map);
    }

    @Override
    public Result findDictCityList(String provCode) {
        List<Map<String,Object>> list = provinceMapper.findDictCityList(provCode);
        Map<String,Object> map = new HashMap<>();
        map.put("dataList",list);
        return  Result.succ(1,"获取数据成功",map);
    }

    @Override
    public Result findDictAreaList(String cityCode) {
        List<Map<String,Object>> list = provinceMapper.findDictAreaList(cityCode);
        Map<String,Object> map = new HashMap<>();
        map.put("dataList",list);
        return  Result.succ(1,"获取数据成功",map);
    }

}
